package co.gov.medellin.ssti.sub.model.service.impl;

import java.util.Collection;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import co.gov.medellin.ssti.sub.model.dao.ProgramaDAO;
import co.gov.medellin.ssti.sub.model.dao.exception.DAOException;
import co.gov.medellin.ssti.sub.model.service.ProgramaService;
import co.gov.medellin.ssti.sub.model.vo.ProgramaVO;

@Service
public class ProgramaServiceImpl implements ProgramaService {
	@Autowired
	ProgramaDAO programaDAOImpl2;

	public List<ProgramaVO> loadAllProgramas() {
		try {
			return programaDAOImpl2.loadAllProgramas();
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	public List<ProgramaVO> loadAllProgramasByArea(String secretaryCode) {
		try {
			return programaDAOImpl2.loadAllProgramasByArea(secretaryCode);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	public Collection<ProgramaVO> findProgramaByUserReport(Long codeUser,
			String userGroupName, Long codeArea) {
		try {
			return programaDAOImpl2.findProgramaByUserReport(codeUser,
					userGroupName, codeArea);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	public Collection<ProgramaVO> findProgramaByCriteria(ProgramaVO criteria) {
		try {
			return programaDAOImpl2.findProgramaByCriteria(criteria);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	public Collection<ProgramaVO> findAllProgramaByCriteria(ProgramaVO criteria) {
		try {
			return programaDAOImpl2.findAllProgramaByCriteria(criteria);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	public Collection<ProgramaVO> findProgramaByCriteria(ProgramaVO criteria,
			Long codeUser, String groupUserName, Long areaUser) {
		try {
			return programaDAOImpl2.findProgramaByCriteria(criteria, codeUser,
					groupUserName, areaUser);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	public Collection<ProgramaVO> findProgramaByCriteriaOB(ProgramaVO criteria,
			Long codeUser, String groupUserName, Long areaUser) {
		try {
			return programaDAOImpl2.findProgramaByCriteriaOB(criteria,
					codeUser, groupUserName, areaUser);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	public Collection<ProgramaVO> findProgramaWithoutSede(ProgramaVO criteria,
			Long codeUser, String groupUserName, Long areaUser) {
		try {
			return programaDAOImpl2.findProgramaWithoutSede(criteria, codeUser,
					groupUserName, areaUser);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	public Collection<ProgramaVO> findProgramaByCriteria(ProgramaVO criteria,
			String groupUserName, Long codeUser, Long areaUser) {
		try {
			return programaDAOImpl2.findProgramaByCriteria(criteria,
					groupUserName, codeUser, areaUser);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	public Collection<ProgramaVO> findProgramaByCriteriaReport(
			ProgramaVO criteria, String groupUserName, Long codeUser,
			Long areaUser) {
		try {
			return programaDAOImpl2.findProgramaByCriteriaReport(criteria,
					groupUserName, codeUser, areaUser);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	public Collection<ProgramaVO> findProgramaWithoutVigencia(
			String groupUserName, Long codeUser, Long areaUser) {
		try {
			return programaDAOImpl2.findProgramaWithoutVigencia(groupUserName,
					codeUser, areaUser);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	public boolean EstadoPrograma(ProgramaVO criteria) {
		try {
			return programaDAOImpl2.EstadoPrograma(criteria);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	public int getActivarProg(ProgramaVO criteria) {
		try {
			return programaDAOImpl2.getActivarProg(criteria);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	public Collection<ProgramaVO> getProgramasVigentes(ProgramaVO criteria,
			String groupUserName, Long codeUser, Long areaUser,
			boolean controlAcceso) {
		try {
			return programaDAOImpl2.getProgramasVigentes(criteria,
					groupUserName, codeUser, areaUser, controlAcceso);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	public String getNameByCode(String strCodeProg) {
		try {
			return programaDAOImpl2.getNameByCode(strCodeProg);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	public Collection<ProgramaVO> findProgramaByCriteriaWithGestor(
			ProgramaVO criteria, String groupUserName, Long codeUser,
			Long areaUser) {
		try {
			return programaDAOImpl2.findProgramaByCriteriaWithGestor(criteria,
					groupUserName, codeUser, areaUser);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	public int update(ProgramaVO vo) {
		try {
			return programaDAOImpl2.update(vo);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	@Override
	public int findCantidadSubprogramas(Long codePrograma) {
		try {
			return programaDAOImpl2.findCantidadSubprogramas(codePrograma);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	@Override
	public int inactivarPrograma(ProgramaVO programaVO) {
		try {
			return programaDAOImpl2.inactivarPrograma(programaVO);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	@Override
	public int insert(ProgramaVO programaVO) {
		try {
			return programaDAOImpl2.insert(programaVO);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

}
